home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 19 / Amiga Format CD19 (1997-10-02)(Future Publishing)(GB)(Track 1 of 5)[!][issue 1997-11].iso / -seriously_amiga- / shareware / misc / uninstaller / uninstalleren.rexx < prev    next >
OS/2 REXX Batch file  |  1997-08-26  |  3KB  |  87 lines

  1. /* UnInstaller v1.0 by Panokostas Dimitris */
  2.  
  3. Options Results
  4. addlib("libs:rexxsupport.library", 0, -30, 34)
  5. addlib("libs:rexxreqtools.library", 0, -30, 0)
  6. NL='0a'x
  7. rtezrequest("Welcome to UnInstaller v1.0." || NL ||,
  8.              "Created by Panokostas Dimitris in 1997","Proceed")
  9. rtezrequest("You have to specify an Installer logfile","Pick a logfile | Never Mind")
  10. if rtresult=0 then call Finished
  11. logfile=rtfilerequest(, , "Pick an Installer logfile", ,)
  12. if logfile="" then call Finished
  13. open(1,logfile,"R")
  14. i=0;d=0
  15. do until eof(1)
  16.   OneLine=ReadLN(1)
  17.   If Index(OneLine,"Copy")>0 then do
  18.     i=i+1
  19.     InstFileTmp=substr(OneLine,pos('"',OneLine),(pos('"',OneLine,(pos('"',OneLine)+1)))-(pos('"',OneLine)-1))
  20.     InstPath=Strip(substr(OneLine,pos("to",OneLine)+3),,".")
  21.     If LastPos("/",InstFileTmp)>0 then InstFile=SubStr(InstFileTmp,LastPos("/",InstFileTmp)+1)
  22.     If LastPos(":",InstFileTmp)>0 then InstFile=SubStr(InstFileTmp,LastPos(":",InstFileTmp)+1)
  23.     If LastPos(":",InstFileTmp)=0 then InstFile=InstFileTmp
  24.     If Right(InstPath,2)~='/"' & Right(InstPath,2)~=':"' then InstPath=Strip(InstPath,,'"')||"/"
  25.     InstFull.I=strip(InstPath,,'"')||strip(InstFile,,'"')
  26.   end
  27.   If Index(OneLine,"User made a new drawer:")>0 then do
  28.     d=d+1
  29.     InstDrawer.d=strip(substr(OneLine,pos('"',OneLine),(pos('"',OneLine,(pos('"',OneLine)+1)))-(pos('"',OneLine)-1)),,'"')
  30.   end
  31. end
  32.  
  33. If I>0 then
  34.   do j=1 to i
  35.         rtezrequest("Delete this file?" || NL ||,
  36.                     InstFull.j,"Abort | Yes | No | Delete All")
  37.  
  38.   if rtresult=1 then call Finished
  39.   if rtresult=0 then rtezrequest("Are you sure about that?","Yes | No")
  40.         if rtresult=1 then do
  41.           j=i
  42.           call DeleteAll
  43.           call Finished
  44.         end
  45.   if rtresult=2 then do
  46.         if exists(InstFull.j) then delete(InstFull.j)
  47.   end
  48.   if rtresult=3 then noop
  49. end
  50. Call DrawerCleanUp
  51.  
  52. DrawerCleanUp:
  53. If D>0 then
  54.   do j=1 to d
  55.         rtezrequest("Delete this drawer?" || NL ||,
  56.                     InstDrawer.j,"Abort | Yes | No | Delete All")
  57.  
  58.   if rtresult=1 then call Finished
  59.   if rtresult=0 then rtezrequest("Are you sure about that?","Yes | No")
  60.         if rtresult=1 then do
  61.           j=d
  62.           call DeleteAllDrawers
  63.           call DrawerCleanUp
  64.         end
  65.   if rtresult=2 then do
  66.         if exists(InstDrawer.j) then delete(InstDrawer.j)
  67.         if exists(InstDrawer.j||".info") then delete(InstDrawer.j||".info")
  68.   end
  69.   if rtresult=3 then noop
  70. end
  71. Call Finished
  72.  
  73. Finished:
  74. rtezrequest("Finished!")
  75. exit
  76.  
  77. DeleteAll:
  78. do j=1 to i
  79.         if exists(InstFull.j) then delete(InstFull.j)
  80. end
  81.  
  82. DeleteAllDrawers:
  83. do j=1 to d
  84.         if exists(InstDrawer.j) then delete(InstDrawer.j)
  85.         if exists(InstDrawer.j||".info") then delete(InstDrawer.j||".info")
  86. end
  87.